package net.pantolomin.nayo.api;

import java.util.concurrent.ExecutorService;

/**
 * The configuration for the NIO provider
 */
public interface Configuration {
	/**
	 * Get the executor to use for reading
	 * 
	 * @param threadGroup
	 *          the thread group
	 * @return the executor to use for reading
	 */
	ExecutorService getExecutorForReading(ThreadGroup threadGroup);

	/**
	 * Get the executor to use for writing
	 * 
	 * @param threadGroup
	 *          the thread group
	 * @return the executor used for writing
	 */
	ExecutorService getExecutorForWriting(ThreadGroup threadGroup);

	/**
	 * Get the maximum time to wait for connection establishment
	 * 
	 * @return the maximum time to wait for connection establishment
	 */
	long getConnectionTimeout();

	/**
	 * Get the maximum time since the last received "ping" message. The connection is considered to be dead after this delay.
	 * 
	 * @return the maximum time before considering an "idle" connection as "disconnected remotely"
	 */
	long getMaxIdleTime();

	/**
	 * Get the maximum size to read at a time. This value will be capped between 1kB and 256kB.
	 * 
	 * @return the size of the read buffers
	 */
	int getReadBufferSize();

	/**
	 * Get the maximum number of consecutive writes on the socket before letting other writes proceed. "1" is fair, bigger values can give a higher throughput.
	 * "0" or negative are handled as "1".
	 * 
	 * @return the fairness to apply when writing
	 */
	int getWriteFairness();
}